package com.database.dao;

import android.database.sqlite.SQLiteDatabase;

import java.util.Map;

import de.greenrobot.dao.AbstractDao;
import de.greenrobot.dao.AbstractDaoSession;
import de.greenrobot.dao.identityscope.IdentityScopeType;
import de.greenrobot.dao.internal.DaoConfig;

import com.database.dao.Account;
import com.database.dao.Notepad;
import com.database.dao.Schedule;

import com.database.dao.AccountDao;
import com.database.dao.NotepadDao;
import com.database.dao.ScheduleDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see de.greenrobot.dao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig accountDaoConfig;
    private final DaoConfig notepadDaoConfig;
    private final DaoConfig scheduleDaoConfig;

    private final AccountDao accountDao;
    private final NotepadDao notepadDao;
    private final ScheduleDao scheduleDao;

    public DaoSession(SQLiteDatabase db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        accountDaoConfig = daoConfigMap.get(AccountDao.class).clone();
        accountDaoConfig.initIdentityScope(type);

        notepadDaoConfig = daoConfigMap.get(NotepadDao.class).clone();
        notepadDaoConfig.initIdentityScope(type);

        scheduleDaoConfig = daoConfigMap.get(ScheduleDao.class).clone();
        scheduleDaoConfig.initIdentityScope(type);

        accountDao = new AccountDao(accountDaoConfig, this);
        notepadDao = new NotepadDao(notepadDaoConfig, this);
        scheduleDao = new ScheduleDao(scheduleDaoConfig, this);

        registerDao(Account.class, accountDao);
        registerDao(Notepad.class, notepadDao);
        registerDao(Schedule.class, scheduleDao);
    }
    
    public void clear() {
        accountDaoConfig.getIdentityScope().clear();
        notepadDaoConfig.getIdentityScope().clear();
        scheduleDaoConfig.getIdentityScope().clear();
    }

    public AccountDao getAccountDao() {
        return accountDao;
    }

    public NotepadDao getNotepadDao() {
        return notepadDao;
    }

    public ScheduleDao getScheduleDao() {
        return scheduleDao;
    }

}
